/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.cotec.model;

import java.io.Serializable;
import java.util.Collection;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author magalhaes
 */
@Entity
@Table(name = "status")
@NamedQueries({@NamedQuery(name = "Status.findAll", query = "SELECT s FROM Status s"), 
			   @NamedQuery(name = "Status.findById", query = "SELECT s FROM Status s WHERE s.id = :id"),
			   @NamedQuery(name = "Status.findByNome", query = "SELECT s FROM Status s WHERE s.nome = :nome"),
			   @NamedQuery(name = "Status.findByDescricao", query = "SELECT s FROM Status s WHERE s.descricao = :descricao")})
public class Status implements Serializable {
    private static final long serialVersionUID = 1L;
    
    // Status
    public static int NOVA = 1;
    public static int EM_ATENDIMENTO = 2;
    public static int AGUARDANDO_APROVACAO = 3;
    public static int RESOLVIDO = 4;
    public static int CONCLUIDO = 5;

    // Usuarios
    public static String USUARIO = "USUARIO";
    public static String USUARIO_SISTEMA = "WEBCOTEC";
    
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Long id;
    @Basic(optional = false)
    @Column(name = "nome", length=25)
    private String nome;
    @Column(name = "descricao", length=80)
    private String descricao;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "status")
    private Collection<Inbox> inboxCollection;
    @Basic(optional = false)
    @Column(name = "usuario", length=15)
    private String usuario;
    @Basic(optional = true)
    @Column(name = "sistema")
    private Boolean sistema;
    
    public Status() {
    }

    public Status(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getDescricao() {
        return descricao;
    }

    public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    public Collection<Inbox> getInboxCollection() {
        return inboxCollection;
    }

    public void setInboxCollection(Collection<Inbox> inboxCollection) {
        this.inboxCollection = inboxCollection;
    }

    public String getUsuario() {
		return usuario;
	}

	public void setUsuario(String usuario) {
		this.usuario = usuario;
	}    
    
    public Boolean getSistema() {
		return sistema;
	}

	public void setSistema(Boolean sistema) {
		this.sistema = sistema;
	}

	@Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Status)) {
            return false;
        }
        Status other = (Status) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.cotec.model.Status[id=" + id + "]";
    }

}
